package com.example.myapplication3.audio.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;
import com.example.myapplication3.R;
import com.example.myapplication3.audio.bean.AudioItem;
import com.example.myapplication3.video.bean.VideoItem;

import java.util.List;

public class AudioAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
    private List<AudioItem> audiolist;
    private Context context;
    private int mode = LIST;
    private static final int LIST=1;
    private static final int GRID=2;
    public AudioAdapter(List<AudioItem> audiolist, Context context) {
        this.audiolist = audiolist;
        this.context = context;
    }

    @Override
    public int getItemViewType(int position) {return mode; }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View itemview;
        switch (viewType){
            case GRID:
              itemview = LayoutInflater.from(context).inflate(R.layout.item_grid_,parent,false);
                return new GridViewHolder(itemview);
            case LIST:
            default: 
                itemview =LayoutInflater.from(context).inflate(R.layout.item_list_,parent,false);
                return new LinearViewHolder(itemview);
        }
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
        AudioItem audioItem = audiolist.get(position);
        if (holder instanceof GridViewHolder){

        }
    }

    @Override
    public int getItemCount() {
        return audiolist.size();
    }
private class LinearViewHolder extends RecyclerView.ViewHolder{
    public LinearViewHolder(@NonNull View itemView) {
        super(itemView);
    }
}
    private class GridViewHolder extends RecyclerView.ViewHolder{
        public GridViewHolder(@NonNull View itemView) {
            super(itemView);
        }
    }
}